package hikari.preferences;

import com.gooddies.wiring.annotations.Wire;
import com.gooddies.wiring.annotations.WiringComponent;
import hikari.managers.Manager3D;
import hikari.objects3d.Camera3dObject;
import hikari.persistence.propertieseditor.annotation.Property;
import hikari.preferences.scene_parameters.ColorPropertyEditor;
import org.swig.jirr.SColor;
import org.swig.jirr.SColorf;

/**
 * @author sad
 */
@WiringComponent(singleton = false)
public class SceneProperties {

    @Wire
    private Manager3D manager3D;
    @Property(id = "amb_light", caption = "Ambient Light", editor = ColorPropertyEditor.class, help = "Default lighting regardless any other dynamic lights")
    private SColor ambientLight;
    private Camera3dObject mainCamera;

    private SceneProperties() {
    }

    public SColor getAmbientLight() {
        if (ambientLight == null) {
            ambientLight = SColor.BLACK;
        }
        return ambientLight;
    }

    public void setAmbientLight(SColor ambientLight) {
        this.ambientLight = ambientLight;
    }

    public Camera3dObject getMainCamera() {
        return mainCamera;
    }

    public void setMainCamera(Camera3dObject mainCamera) {
        this.mainCamera = mainCamera;
    }

    public void updateScene() {
        manager3D.getVideoDriver().setAmbientLight(new SColorf(ambientLight));
    }
}
